package org.redmaple.core.retrieving.hibernate;

import org.hibernate.criterion.Order;
import org.redmaple.core.retrieving.Sort;
import org.redmaple.core.retrieving.Sort.SortType;

public class OrderPlugin {
	public static Order convert(Sort sort, String entityName) {
		if(sort.getSortType().equals(SortType.ASC)) {
			return Order.asc(entityName + "." + sort.getPropertyName());
		}else {
			return Order.desc(entityName + "." + sort.getPropertyName());
		}
	}
}
